/**
 * @file async_transceiver.h
 * @author 王烨
 * @date 2011-01-10
**/

#ifndef ASYNC_TRANSCEIVER_H_INCLUDED
#define ASYNC_TRANSCEIVER_H_INCLUDED

#include <string>

namespace skeleton
{
  /*异步收发器，可以在客户端和服务端使用*/
  class AsyncTransceiver
  {
  public:
    /*监听TCP端口*/
    void Listen(const std::string &addr, unsigned short port);
    virtual void Listen(const char *addr, unsinged short port) = 0;
    /*监听域socket*/
    void Listen(const std::string &path);
    virtual void Listen(const char *path);
    /*连接TCP端口*/
    void Connect(const std::string &host, unsinged short port);
    virtual void Connect(const char *host, unsinged short port) = 0;
    /*连接域socket*/
    void Connect(const std::string &path);
    virtual void Connect(const char *path) = 0;
    /*是否已连接*/
    virtual bool IsConnected() = 0;
    /*关闭连接*/
    virtual void Close() = 0;
  };
}
#endif
